package org.luckystrophe.snowtoms.model.impl;

import org.json.JSONException;
import org.json.JSONObject;
import org.luckystrophe.snowtoms.R;
import org.luckystrophe.snowtoms.model.JsonRequestPOST;
import org.luckystrophe.snowtoms.pref.UserPreference_;

import android.content.Context;

import com.googlecode.androidannotations.annotations.EBean;
import com.googlecode.androidannotations.annotations.RootContext;
import com.googlecode.androidannotations.annotations.res.StringRes;
import com.googlecode.androidannotations.annotations.sharedpreferences.Pref;

@EBean
public class RequestSendReply extends JsonRequestPOST {

	@RootContext
	Context context;

	@Pref
	UserPreference_ pref;

	@StringRes(R.string.api_method_writeReply)
	String apiMethod;

	String replyComment;

	long msgId;

	@Override
	public JSONObject getBody() throws JSONException {
		JSONObject jo = new JSONObject();
		JSONObject params = new JSONObject();

		params.put("usrId", pref.usrId().get());
		params.put("msgId", msgId);
		params.put("reply", replyComment);

		jo.put("method", apiMethod);
		jo.put("params", params);
		return jo;
	}

	public void setWriteReplyParams(long msgId, String replyComment) {
		this.msgId = msgId;
		this.replyComment = replyComment;
	}

}
